package com.geotmt.billingcenter.modules.designmode.rulesfactory.impl;

import com.geotmt.billingcenter.common.vo.params.RuleVo;
import com.geotmt.billingcenter.modules.designmode.rulesfactory.RulesFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description 查得计费
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/3/25 13:22
 * @Version     v1
 **/
public class GetBilling implements RulesFactory {

    private static final Logger logger = LoggerFactory.getLogger(GetBilling.class);

    @Override
    public Double getMoney(RuleVo ruleVo) {
        logger.info("查得计费 ==== 具体实现");
        Double money = 0d;
        Integer countGet = ruleVo.getCountGet();
        Double discount = ruleVo.getDiscount();
        if(null != countGet){
            money = countGet * ruleVo.getPrice();
            if(null != discount){
                money = money * discount;
            }
        }
        return money;
    }

}
